<?php

namespace App\Http\Resources\OpenShop\InvestmentPromotion;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class UserExtContractResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            'contractId'    => $this->contractId,
            'contractExtNo' => $this->contractExtNo,
            'contractName'  => $this->contractName,
            'contractUrl'   => $this->contractUrl,
            'previewUrl'    => privateFilePath($this->previewUrl),
            'downloadUrl'   => privateFilePath($this->downloadUrl),
            'signStatus'    => $this->signStatus,
            'createdAt'     => $this->createdAt->timestamp > 0 ? formatDate($this->createdAt->timestamp) : '-',
            'signTime'      => formatDate($this->signTime),
        ];
    }
}
